<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="admin/public/layout">

<head>
    <title>站点设置</title>
</head>
<div  layout:fragment="content">
    <section class="content-header">
        <h1>
            站点设置
            <small>站点信息设置</small>
        </h1>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="callout callout-warning" th:if="${error}">
                    <h4>数据保存失败！</h4>
                    <ol>
                        <li  th:text="${error.message}"></li>
                    </ol>
                </div>
                <div class="box box-primary">
                    <form th:object="${settingWebsite}" role="form" name="addForm" id="website_form" method="POST" th:action="@{/admin/setting/website}">
                        <div class="box-body">
                            <input type="hidden" name="id" th:value="${GlobalSetting.website.id}"/>
                            <div th:class="${#fields.hasErrors('name')}?'form-group has-error':'form-group '">
                                <label>站点名称</label>
                                <span class="text-muted">(网站名称，将显示在页面Title处)</span>
                                <input type="text" name="name" class="form-control " placeholder="网站名称，将显示在页面Title处" th:value="${settingWebsite.name}">
                                <p class="help-block" th:if="${#fields.hasErrors('name')}" th:text="${#fields.errors('name')[0]}"></p>
                            </div>

                            <div th:class="${#fields.hasErrors('slogan')}?'form-group has-error':'form-group '">
                                <label>站点slogan</label>
                                <span class="text-muted">(网站口号)</span>
                                <input type="text" name="slogan" class="form-control " placeholder="最好的JAVA问答社区" th:value="${settingWebsite.slogan}">
                                <p class="help-block" th:if="${#fields.hasErrors('slogan')}" th:text="${#fields.errors('slogan')[0]}"></p>
                            </div>

                            <div th:class="${#fields.hasErrors('welcome')}?'form-group has-error':'form-group '">
                                <label>首页欢迎语</label>
                                <span class="text-muted">(例如：欢迎加入一起smart问答社区，问答互助大家帮)</span>
                                <input type="text" name="welcome" class="form-control " placeholder="首页欢迎语" th:value="${settingWebsite.welcome}">
                                <p class="help-block" th:if="${#fields.hasErrors('welcome')}" th:text="${#fields.errors('welcome')[0]}"></p>
                            </div>

                            <div th:class="${#fields.hasErrors('url')}?'form-group has-error':'form-group '">
                                <label>站点地址</label>
                                <span class="text-muted">(您站点的完整域名。例如: http://www.tipask.com，不要以斜杠 (“/”) 结尾)</span>
                                <input type="text" name="url" class="form-control " placeholder="填写您站点的完整域名" th:value="${settingWebsite.url}">
                                <p class="help-block" th:if="${#fields.hasErrors('url')}" th:text="${#fields.errors('url')[0]}"></p>
                            </div>

                            <div th:class="${#fields.hasErrors('adminEmail')}?'form-group has-error':'form-group '">
                                <label >管理员电子邮箱</label>
                                <span class="text-muted">(站点管理员的邮箱地址)</span>
                                <input type="text" name="adminEmail" class="form-control " placeholder="填写您站点的管理员邮箱地址"  th:value="${settingWebsite.adminEmail}">
                                <p class="help-block" th:if="${#fields.hasErrors('adminEmail')}" th:text="${#fields.errors('adminEmail')[0]}"></p>
                            </div>


                            <div th:class="${#fields.hasErrors('icp')}?'form-group has-error':'form-group '">
                                <label>网站备案号</label>
                                <span class="text-muted">(格式类似“京ICP证030173号”，它将显示在页面底部，没有请留空)</span>
                                <input type="text" name="icp" class="form-control " placeholder="格式类似“京ICP证030173号”，它将显示在页面底部，没有请留空" th:value="${settingWebsite.icp}">
                                <p class="help-block" th:if="${#fields.hasErrors('icp')}" th:text="${#fields.errors('icp')[0]}"></p>
                            </div>

                            <div class="form-group">
                                <label>网站默认模板</label>
                                <span class="text-muted">(网站的前台默认显示的模板)</span>
                                <select name="website_theme" class="form-control">
                                    <option value="default" selected >默认</option>
                                </select>
                            </div>

                            <div th:class="${#fields.hasErrors('cacheTime')}?'form-group has-error':'form-group '">
                                <label>系统缓存时间（分钟）</label>
                                <span class="text-muted">(设置范围是1-8640，缓存相关数据，包括首页缓存、积分排行榜等)</span>
                                <input type="text" name="cacheTime" class="form-control " placeholder="系统缓存时间"  th:value="${settingWebsite.cacheTime}">
                                <p class="help-block" th:if="${#fields.hasErrors('cacheTime')}" th:text="${#fields.errors('cacheTime')[0]}"></p>
                            </div>

                            <div th:class="${#fields.hasErrors('header')}?'form-group has-error':'form-group '">
                                <label>页面头部扩展</label>
                                <span class="text-muted">(扩展头部信息，例如meta标签等)</span>
                                <textarea class="form-control" style="height: 100px;" name="header" th:text="${settingWebsite.header}"></textarea>
                                <p class="help-block" th:if="${#fields.hasErrors('header')}" th:text="${#fields.errors('header')[0]}"></p>
                            </div>

                            <div th:class="${#fields.hasErrors('footer')}?'form-group has-error':'form-group '">
                                <label>页面底部扩展</label>
                                <span class="text-muted">(扩展body前的底部信息,例如第三方统计代码等)</span>
                                <textarea class="form-control" style="height: 100px;" name="footer" th:text="${settingWebsite.footer}"></textarea>
                                <p class="help-block" th:if="${#fields.hasErrors('footer')}" th:text="${#fields.errors('footer')[0]}"></p>
                            </div>

                            <div th:class="${#fields.hasErrors('shareCode')}?'form-group has-error':'form-group '">
                                <label>第三方分享代码</label>
                                <span class="text-muted">(百度分享或者jiathis等第三方分享代码)</span>
                                <textarea class="form-control" style="height: 100px;" name="shareCode" th:text="${settingWebsite.shareCode}"></textarea>
                                <p class="help-block" th:if="${#fields.hasErrors('shareCode')}" th:text="${#fields.errors('shareCode')[0]}"></p>
                            </div>

                        </div>
                        <div class="box-footer">
                            <button type="button" id="saveBtn" class="btn btn-primary" name="submitBtn">保存</button>
                            <button type="reset" class="btn btn-success">重置</button>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </section>
    <script type="text/javascript">
        $(function(){
            $("#saveBtn").click(function(){
                $("#website_form").submit();
            });

        });
    </script>
</div>